package com.ruoyi.accountant.mapper;

import com.ruoyi.accountant.domain.Reason;
import com.ruoyi.accountant.domain.ReasonExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.Query;

public interface ReasonMapper {
    int countByExample(ReasonExample example);

    int deleteByExample(ReasonExample example);

    int deleteByPrimaryKey(Long rid);

    int insert(Reason record);

    int insertSelective(Reason record);

    List<Reason> selectByExample(ReasonExample example);

    Reason selectByPrimaryKey(Long rid);

    int updateByExampleSelective(@Param("record") Reason record, @Param("example") ReasonExample example);

    int updateByExample(@Param("record") Reason record, @Param("example") ReasonExample example);

    int updateByPrimaryKeySelective(Reason record);

    int updateByPrimaryKey(Reason record);

    List<Reason> findAllByParent(@Param("parent")Long parent);

    List<Reason> findAllByLevel(@Param("level")Integer level);

    Reason findByRname(@Param("rname")String rname);

    @Select("select * from t_reason where rid in (select distinct i.of_reason from t_transaction_detail as i where i.dtype = #{type} group by i.of_reason)")
    List<Reason> findByIds(@Param("type") String type);




}